package javaTest01;

import java.util.Scanner;

public class GetBonusByProfit {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("输入利润");
        int profit=input.nextInt();
        System.out.println("奖金为:"+getBonus(profit));
    }

    /**
     * @param profit 输入的利润
     * @return 计算出的奖金
     */
    private static int getBonus(int profit) {
        int bonus=0;
        if (profit<100000){
            bonus+=profit*0.1;
        }else if (profit<200000){
            bonus+=10000+(profit-100000)*0.075;
        }
        else if (profit<400000){
            bonus+=100000*0.1+100000*0.075+(profit-200000)*0.05;
        }else if (profit<600000){
            bonus+=100000*0.1+100000*0.075+200000*0.05+(profit-400000)*0.03;
        }else if (profit<1000000){
            bonus+=100000*0.1+100000*0.075+200000*0.05+200000*0.03+(profit-600000)*0.015;
        }else {
            bonus+=100000*0.1+100000*0.075+200000*0.05+200000*0.03+400000*0.015+(profit-1000000)*0.01;
        }
        return bonus;
    }
}
